package cn.xiangyuanpin.tests;

import cn.xiangyuanpin.dao.BookDao;
import cn.xiangyuanpin.dao.impl.BookDaoImpl;
import cn.xiangyuanpin.pojo.Book;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.List;

import static org.junit.Assert.*;

public class BookDaoTest {
private BookDao bookDao=new BookDaoImpl();
    @Test
    public void addBook() {
         bookDao.addBook(new Book(null,"java基础教程","向元拼",new BigDecimal(1000),999999,0,null));

    }

    @Test
    public void deleteBookById() {
    }

    @Test
    public void updateBook() {
        bookDao.updateBook(new Book(21,
                "java基础教程++","向元拼++",new BigDecimal(1000),999999,0,null));
    }

    @Test
    public void queryBookById() {
        System.out.println(bookDao.queryBookById(21));
    }

    @Test
    public void queryBooks() {
        for(Book book:bookDao.queryBooks()){
            System.out.println(book);
        }
    }


@Test
    public void queryForPageTotalCount() {
    System.out.println(bookDao.queryForPageTotalCount());
    }

@Test
    public void queryForPageItems() {
        for(Book book:bookDao.queryForPageItems(4,8)){
            System.out.println(book);
        }
    }
}